package DailyPractice.Day22;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author lumin
 * @date 2022/05/19 16:04
 **/
public class Num1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int m = sc.nextInt();
            int power = sc.nextInt();
            int[] nums = new int[m];
            for (int i = 0; i < m; i++) {
                nums[i] = sc.nextInt();
                if (nums[i] <= power) {
                    power += nums[i];
                } else {
                    power += gcd(power, nums[i]);
                }
            }
            System.out.println(power);
        }
    }

    private static int gcd(int power, int i) {
        for (int j = power; j > 1; j--) {
            if(power % j == 0 && i % j == 0){
                return j;
            }
        }
        return 1;
    }
}